﻿using Autofac;
using System.Reflection;

namespace MES.Core.Extension
{
    public class AutofacModule : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            //把服务的注入规则写在这里
            //builder.RegisterType<TestService>().As<ITestService>();
            Assembly Codeassembly = Assembly.Load("MES.Core");
            Assembly Serviceassembly = Assembly.Load("MES.Service");
            //Assembly assembly = Assembly.GetExecutingAssembly();
            builder.RegisterAssemblyTypes(Codeassembly, Serviceassembly).AsImplementedInterfaces().InstancePerDependency();
        }
    }
}
